﻿using System;
using System.Net;

namespace SharePointSearchBench.Library
{
    /// <summary>
    /// A base class from which all SharePoint search objects must derive.  It contains
    /// properties that are common to any search method.
    /// </summary>
    public abstract class BaseQuery
    {
        ApiSource apiSource;
        Uri contextUri;
        NetworkCredential credentials;
        int resultCount;

        /// <summary>
        /// Creates a new instance of the class.
        /// </summary>
        protected BaseQuery()
        {
            this.resultCount = 100;
        }

        /// <summary>
        /// Gets or sets whether the object model or the
        /// search service is used as the means for executing
        /// searches against SharePoint.
        /// </summary>
        public ApiSource ApiSource
        {
            get { return this.apiSource; }
            set { this.apiSource = value; }
        }

        /// <summary>
        /// Gets or sets the credentials that should be used
        /// for web service calls.
        /// </summary>
        public NetworkCredential Credentials
        {
            get { return this.credentials; }
            set { this.credentials = value; }
        }

        /// <summary>
        /// Gets or sets the Uri used for search execution.  This Uri
        /// indicates the site Uri for object model searches and the
        /// web service Uri for web service searches.
        /// </summary>
        public Uri ContextUri
        {
            get { return this.contextUri; }
            set { this.contextUri = value; }
        }

        /// <summary>
        /// Gets or sets the number of results to return.
        /// </summary>
        public int ResultCount
        {
            get { return this.resultCount; }
            set { this.resultCount = value; }
        }
    }
}
